#include<iostream>
#include<vector>
#include<string>
#include<math.h>
#include<map>
using namespace std;

class Solution {
public:
	int maxPoints(vector<vector<int>>& points) {
		if (points.size() == 1) return 1;
		map<pair<double, double>, int> lines;
		int ptsline = -1;
		for (int i = 0; i < points.size(); i++) {
			for (int j = i + 1; j < points.size(); j++) {
				double k, b;
				if (points[i][0] == points[j][0]) {
					k = INT_MAX;
					b = points[i][0];
				}
				else {					
					k = (points[i][1] - points[j][1]) / double(points[i][0] - points[j][0]);
					k = round(k*1000)/1000;
					b = points[i][1] - k * points[i][0];
					b = round(b * 1000) / 1000;
				}
				if(!lines.count(make_pair(k, b)))
					lines[make_pair(k, b)]=0;
			}
		}
		for (auto &element : lines) {
			for (int i = 0; i < points.size(); i++) {
				if (element.first.first == INT_MAX) {
					if (element.first.second == points[i][0])
						element.second += 1;
				}
				else if (abs(points[i][1] - element.first.first*points[i][0] + element.first.second)<0.001)
					element.second += 1;
			}
			if (ptsline < element.second)
				ptsline = element.second;
		}
		
		return ptsline;
	}
};

int main() {
	vector<vector<int>> pts = { {-6,-1},{3,1},{12,3}};
	vector<vector<int>> pts2 = { {1,1},{3,2},{5,3},{4,1},{2,3},{1,4} };
	Solution s;
	s.maxPoints(pts);
	return -1;
}